Repository navigation
fix(provenance): prefer canonical ds id when multiple IsDerivedFrom entries - #20
Merged
neuromechanist merged 1 commit intoMay 18, 2026
Conversation
…ntries Re-released OpenNeuro datasets carry both the original and the canonical id as IsDerivedFrom in metadata.json. on002718 was originally released as ds000117 then re-released as ds002718; both ids appear in related_identifiers and the old loop locked onto whichever came first with ??= (ds000117 in this case). Collect candidate matches into a list, then prefer the one whose extracted ds id matches the canonical on->ds swap. Fall back to first candidate when nothing matches, and to the swap-only path when there are no IsDerivedFrom entries at all (existing behavior). Refs #19
Deploying nemar-website with
|
| Latest commit: |
a485d00
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ba88c1e1.nemar-website.pages.dev |
| Branch Preview URL: | https://feature-issue-19-provenance.nemar-website.pages.dev |
neuromechanist
merged commit May 18, 2026
fcbdc88
into
feature/issue-1-epic-nemar-redesign
1 check passed
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #19
Summary
The provenance chip and OpenNeuro action-bar link on `/dataset/on002718` showed `ds000117` instead of the canonical `ds002718`. `metadata.json` lists both as `IsDerivedFrom` (the dataset was re-released on OpenNeuro under a new id) and the old loop locked onto whichever came first.
Fix
Collect all candidate matches into a list, then prefer the one whose extracted ds id matches the canonical on->ds swap (`on002718` -> `ds002718`). Fall back to first candidate when nothing matches, and to the id-swap-only path when there are no `IsDerivedFrom` entries at all (existing behavior preserved).
Tests
Two new tests in `provenance.test.ts`:
71/71 passing, typecheck 0 errors.
Verification on live data
`api.nemar.org/datasets/on002718` has `source_id: "ds002718"`. `data.nemar.org/on002718/metadata.json` has both `10.18112/openneuro.ds000117` (the historic id) and `10.18112/openneuro.ds002718.v1.1.0` (canonical) as `IsDerivedFrom`. Fix makes ds002718 win.